using System;
using System.Collections.Generic;
using System.Linq;
using Vk.Methods.Groups;
using Vk.Methods.Users;

namespace Vk.Methods.Wall
{
    public class ItemsProfilesGroups<T>
    {
        public List<Group> Groups { get; private set; }

        public List<T> Items { get; private set; }
        public List<User> Profiles { get; private set; }

        public ItemsProfilesGroups(ApiNode node, Func<ApiNode, T> selector)
        {
            Items = node.SelectNodes("items/*").Select(selector).ToList();
            Profiles = node.SelectNodes("profiles/*").Select(x => new User(x)).ToList();
            Groups = node.SelectNodes("groups/*").Select(x => new Group(x)).ToList();
        }
    }

    public class ItemsCountProfilesGroups<T> : ItemsProfilesGroups<T>
    {
        public int? Count { get; private set; }

        public ItemsCountProfilesGroups(ApiNode node, Func<ApiNode, T> selector) : base(node, selector)
        {
            Count = node.Int("count");
        }
    }

    public class ItemsNextProfilesGroups<T> : ItemsProfilesGroups<T>
    {
        public string Next { get; private set; }

        public ItemsNextProfilesGroups(ApiNode node, Func<ApiNode, T> selector) : base(node, selector)
        {
            Next = node.String("next_from");
        }
    }
}